package cn.wzby;


import java.util.Arrays;

public class Reg1 {
    public static void main(String[] args) {
        String s = "hello420java1013php";
        System.out.println(s.replace("0", "北"));
        //.replace()删除指定字符,并更换成指定字符
        System.out.println(s.replaceAll("\\d", ""));
        System.out.println(s.replaceAll("\\D", ""));
        //   \\d代表数字 ，\\D代表不是数字
        // .replaceAll()删除所指定的字符
        System.out.println(s.replaceFirst("\\d+", ""));
        //删除首次出现的字符串匹配删除
        String a = "java420html1013c++";
        String[] as = a.split("\\d+");
        System.out.println(Arrays.toString(as));

        System.out.println("===正则===");

        System.out.println("abc".matches("a.{2}"));
        //  .点代表一个字符
        System.out.println("a1b2c3".matches("a\\d"));
        System.out.println("a123456".matches("a\\d{6}"));
        System.out.println("a123456".matches("a\\d{6,}"));
        System.out.println("==正则表达手机号==");
        System.out.println("".trim().matches("|1[367]\\d{9}]|.*1[358]\\d{9}]"));
    }
}
